package com.jinmdz.fmis.core.model;

/**
 * Request信息
 *
 * @author LiCongLu
 * @date 2019-12-26 17:13
 */
public class RequestInfo {

    /**
     * 获取能够与“url-pattern”中匹配的路径，注意是完全匹配的部分，*的部分不包括。 
     * 举例：/api/user/logout
     */
    private String servletPath;
    /**
     * 获取项目的根路径
     * 举例：/fmis
     */
    private String contextPath;
    /**
     * 获取根路径到地址结尾
     * 举例：/fmis/api/user/logout
     */
    private String requestURI;
    /**
     * 获取请求的地址链接（浏览器中输入的地址） 
     * 举例：http://localhost:8001/fmis/api/user/logout
     */
    private String requestURL;

    /**
     * 获取“/”在机器中的实际地址，只有部署时才能够正常使用
     * 举例：E:\apache\apache-tomcat-8.5.41-linux\webapps\ROOT\
     */
    private String realPath;
    /**
     * 获取的是使用的协议(http 或https) 
     * 举例：http
     */
    private String scheme;
    /**
     * 获取的是域名(xxx.com)
     * 举例：localhost
     */
    private String serverName;
    /**
     * 获取的是域端口号
     * 举例：8080
     */
    private int serverPort;

    public String getServletPath() {
        return servletPath;
    }

    public RequestInfo setServletPath(String servletPath) {
        this.servletPath = servletPath;
        return this;
    }

    public String getContextPath() {
        return contextPath;
    }

    public RequestInfo setContextPath(String contextPath) {
        this.contextPath = contextPath;
        return this;
    }

    public String getRequestURI() {
        return requestURI;
    }

    public RequestInfo setRequestURI(String requestURI) {
        this.requestURI = requestURI;
        return this;
    }

    public String getRequestURL() {
        return requestURL;
    }

    public RequestInfo setRequestURL(String requestURL) {
        this.requestURL = requestURL;
        return this;
    }

    public String getRealPath() {
        return realPath;
    }

    public RequestInfo setRealPath(String realPath) {
        this.realPath = realPath;
        return this;
    }

    public String getScheme() {
        return scheme;
    }

    public RequestInfo setScheme(String scheme) {
        this.scheme = scheme;
        return this;
    }

    public String getServerName() {
        return serverName;
    }

    public RequestInfo setServerName(String serverName) {
        this.serverName = serverName;
        return this;
    }

    public int getServerPort() {
        return serverPort;
    }

    public RequestInfo setServerPort(int serverPort) {
        this.serverPort = serverPort;
        return this;
    }

    @Override
    public String toString() {
        return "RequestInfo{" +
                "servletPath='" + servletPath + '\'' +
                ", contextPath='" + contextPath + '\'' +
                ", requestURI='" + requestURI + '\'' +
                ", requestURL='" + requestURL + '\'' +
                ", realPath='" + realPath + '\'' +
                ", scheme='" + scheme + '\'' +
                ", serverName='" + serverName + '\'' +
                ", serverPort=" + serverPort +
                '}';
    }
}
